package com.quarkus.exception;

import lombok.extern.slf4j.Slf4j;
import org.jboss.resteasy.reactive.server.ServerExceptionMapper;

import javax.ws.rs.core.Response;

/**
 * @version v1.0
 * @Description: Rest service  全局异常处理
 * @Author: TongRui乀
 * @Date: 2021/1/24 2:46 下午
 *
 *  返回值只支持 Response 或者 Uni<Response>
 */
@Slf4j
public class GlobalExceptionHandler {

    @ServerExceptionMapper
    public Response globalExceptionHandler(Exception e){
        log.error("global exception ", e);
        return Response.status(404).entity("not found").build();
    }

}
